package com.own.component.util.locate.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * LocateModel
 *
 * @author chenxueli
 * @date 2023-08-01 08:37:57
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LocatePositionModel implements Serializable {

    /**
     * 城市
     */
    private String city;

    /**
     * 区县
     */
    private String county;

    /**
     * 获取位置信息
     *
     * @return 位置信息
     */
    public String getPosition() {
        return Stream.of(city, county).filter(Objects::nonNull).collect(Collectors.joining());
    }

}
